[#1301] Fix multiplier cap semantics (Option 3: both caps)#1311
Merged
Conversation
Option 3: LEAST(1 + LEAST(refs + fc, 10) * per_ref, cap). Inner LEAST caps ref-equivalent count at 10 (spec), outer LEAST caps output multiplier (defensive). Adds PGlite test: 11 refs same multiplier as 10 (count cap verified). Closes #1301 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
realproject7
commented
May 26, 2026
realproject7
left a comment
Owner
Author
There was a problem hiding this comment.
@re2 review — APPROVE ✅
| Criterion | Status |
|---|---|
| Option 3 chosen (both input + output caps) | ✅ |
SQL: LEAST(1 + LEAST(refs + fc, 10) * per_ref, cap) |
✅ both columns updated |
| Test: 11 refs → qualified_refs=11, multiplier=3.0 | ✅ count capped at 10 |
| Version 1.41.2 → 1.41.3 (patch) | ✅ |
Math verification:
- Current config:
1 + min(11, 10) * 0.2 = 3.0— equivalent to before - If per_ref changed to 0.5:
1 + min(11, 10) * 0.5 = 6.0→ outer cap → 3.0 — safe - Defensive against independent parameter tuning without formula divergence
PGlite test runs real SQL. No issues found.
project7-interns
approved these changes
May 26, 2026
project7-interns
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR implements #1301 using the selected Option 3 semantics: the weighted_spend SQL now caps ref-equivalent input at 10 and still defensively caps output multiplier. The PGlite coverage includes the 11-ref input-cap case and the existing output-cap case remains in place.
Findings
- None.
Decision
Approve. CI is green for lint/typecheck/unit tests and E2E on run 26453100266.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes multiplier cap semantics drift between spec and SQL implementation.
Option 3 (defensive):
LEAST(1 + LEAST(refs + fc, 10) * per_ref, cap)LEAST(count, 10): caps ref-equivalent count at 10 (matches spec §4.2)LEAST(result, cap): caps output multiplier (defensive against config changes)Mathematically equivalent for current config (
per_ref=0.2, cap=3.0), but now safe if either parameter is tuned independently.Test added: 11 refs → multiplier still 3.0 (count capped at 10, not 11).
Version
1.41.2 → 1.41.3
Closes #1301
🤖 Generated with Claude Code